App({
  onLaunch: function () {
    wx.cloud.init({ env: 'cloud-4gdrjum4859e42c0', traceUser: true })
    wx.cloud.callFunction({ name: 'function', data: { type: "login" } }).then(res => {
      this.globalData.database = res.result.user.database
      this.globalData.userInfo = res.result.user.userInfo
      if(this.globalData.userInfo){
        this.globalData.hasUserInfo = true
      }
    })
  },
  globalData: {
    hasUserInfo: false,
    userInfo: null,
    database: null
  }
})
